// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import util from 'util'
import { Upload } from 'element-ui';
/* 引入iview组件库 */
import iView from 'iview';

import './assets/css/index.less'
import ExtraModal from './components/common/modal'

Vue.use(iView);
Vue.use(Upload);

Vue.config.productionTip = false

Vue.directive('permiss', {
  inserted: function(el, binding) {
        if (!util.permiss.judgetPermiss(binding.value)) {
            el.parentNode.removeChild(el);
        }
  }
});
/* 全局过滤器 */
Vue.filter('date', function(value) {
	return util.util.formatDate(value);
});
Vue.filter('time', function(value) {
	return util.util.formatDates(value);
});
Vue.filter('text', function(value) {
    if (value != null && value != '') {
        return value;
    } else {
        return '-';
    }
});
Vue.filter('status', function(value) {
    if (value != null && value != '') {
        if (value == 0) {
            return '禁用';
        }
        if (value == 1) {
            return '启用';
        }
    }
    return "-";
});
Vue.filter('abbreviate', function(value) {
    return util.util.abbreviate(value);
});

Vue.prototype.$Message.config({
    top: 30,
    duration: 3
});

//替换Modal
Vue.prototype.$Modal = ExtraModal;
Vue.component('Modal', ExtraModal);

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    components: { App },
    store,
    template: '<App/>',
})

